#if !defined(APP_SERIAL2_H)
#define APP_SERIAL2_H
#include <termios.h>
#include "app_device.h"
//设置波特率
typedef enum
{
    BR_9600 = B9600,
    BR_115200 = B115200
}BraudRate;

//校验位枚举
typedef enum
{
    Parity_None = 0,
    Parity_Odd = PARENB | PARODD,
    Parity_Even = PARENB
}Parity;
//停止位枚举
typedef enum
{
    StopBits_1 = 0,
    StopBits_2 = CSTOPB
}StopBits;

//串口设备结构体
typedef struct
{
    Device supre;
    BraudRate brand_rate;
    Parity parity;
    StopBits stop_bits;
}SerialDevice2;

SerialDevice2 *app_serial2_init(char *filename);

/**
 * 设置波特率
 */
int app_serial_setBraudRate2(SerialDevice2 *serial, BraudRate braud_rate);
/**
 * 设置校验位
 */
int app_serial_setParity2(SerialDevice2 *serial, Parity parity);

/**
 * 设置停止位
 */
int app_serial_setStopBits2(SerialDevice2 *serial, StopBits stop_bits);

/**
 * 设置连接类型
 */
int app_serial_setConnectionType2(SerialDevice2 *serial, ConnectionType conn_type);
#endif // APP_SERIAL_H2

